package com.ssy.lingxi.member.merchant.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Objects;

/**
 * 会员权益表
 * @author 万宁
 * @version 2.0.0
 * @date 2020-07-07
 */
@Entity
@Table(schema = "public", name = "ms_mc_member_right_config", indexes = {@Index(name = "ms_mc_member_right_config_member_id_idx", columnList = "memberId"), @Index(name = "ms_mc_member_right_config_role_id_idx", columnList = "roleId"), @Index(name = "ms_mc_member_right_config_status_idx", columnList = "status")})
public class MemberRightConfigDO implements Serializable {
    private static final long serialVersionUID = 6988930195158008474L;

    /**
     * id
     */
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="member_right_config_seq")
    @SequenceGenerator(sequenceName="ms_mc_member_right_config_seq", name="member_right_config_seq",allocationSize = 1)
    private Long id;

    /**
     * 上级会员Id
     */
    @Column
    private Long memberId;

    /**
     * 上级会员角色Id
     */
    @Column
    private Long roleId;

    /**
     * 权益类型， 定义在 MemberRightTypeEnum 中
     */
    @Column
    private Integer rightType;

    /**
     * 权益获取类型，定义在 MemberRightAcquireWayEnum 中
     */
    @Column
    private Integer acquireWay;

    /**
     * 参数设置方式，定义在 MemberRightParamWayEnum 中
     */
    @Column
    private Integer paramWay;

    /**
     * 权益参数
     */
    @Column(columnDefinition = "numeric")
    private BigDecimal parameter;

    /**
     * 状态
     */
    @Column(columnDefinition = "int2")
    private Integer status;

//    /**
//     * 多对一单向关联权益设置
//     */
//    @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
//    @JoinColumn(name = "base_right_config_id", referencedColumnName = "id")
//    private BaseRightConfigDO config;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getMemberId() {
        return memberId;
    }

    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public Integer getRightType() {
        return rightType;
    }

    public void setRightType(Integer rightType) {
        this.rightType = rightType;
    }

    public Integer getAcquireWay() {
        return acquireWay;
    }

    public void setAcquireWay(Integer acquireWay) {
        this.acquireWay = acquireWay;
    }

    public Integer getParamWay() {
        return paramWay;
    }

    public void setParamWay(Integer paramWay) {
        this.paramWay = paramWay;
    }

    public BigDecimal getParameter() {
        return parameter;
    }

    public void setParameter(BigDecimal parameter) {
        this.parameter = parameter;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

//    public BaseRightConfigDO getConfig() {
//        return config;
//    }
//
//    public void setConfig(BaseRightConfigDO config) {
//        this.config = config;
//    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        MemberRightConfigDO that = (MemberRightConfigDO) o;
        return Objects.equals(id, that.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}
